package blue.mqtt4j.client;

import blue.mqtt4j.internal.client.impl.DefaultMqttMessage;

/**
 * Mqtt Message object
 *
 * @author Jin Zheng
 * @since 1.0 2020-10-16
 */
public interface MqttMessage
{
	MqttQoS DEFAULT_QOS = MqttQoS.AT_MOST_ONCE;

	static MqttMessage from(String topic, Object payload)
	{
		return new DefaultMqttMessage(topic, payload);
	}

	static MqttMessage from(String topic, MqttQoS qos, Object payload)
	{
		return new DefaultMqttMessage(topic, qos, payload);
	}

	/**
	 * topic
	 *
	 * @return
	 */
	String topic();

	/**
	 * qos
	 *
	 * @return
	 */
	MqttQoS qos();

	/**
	 * payload
	 *
	 * @return
	 */
	Object payload();

}
